From: Olaf Hering Date: Fri, 24 Oct 2014 14:17:10 +0000 (+0200) Subject: tools/hotplug: add helper script to visualize systemd dependencies X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~4129 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=757df439ab19d3e32540adfa8f642ccca1876d84;p=xen.git tools/hotplug: add helper script to visualize systemd dependencies A small helper to draw a graph with dot(1) and show it with display(1): bash tools/hotplug/Linux/systemd/show_service_dependencies.sh \ tools/hotplug/Linux/systemd/*.in A red line means Requires= aka "enable it" A blue line means After= A green line means Before= Signed-off-by: Olaf Hering Acked-by: Wei Liu --- diff --git a/tools/hotplug/Linux/systemd/show_service_dependencies.sh b/tools/hotplug/Linux/systemd/show_service_dependencies.sh new file mode 100644 index 0000000000..e3e4c68f8e --- /dev/null +++ b/tools/hotplug/Linux/systemd/show_service_dependencies.sh @@ -0,0 +1,31 @@ +#!/bin/bash +# dot(1) from graphviz, display(1) from ImageMagick +# Usage: bash $0 tools/hotplug/Linux/systemd/*.in +( +echo " digraph systemd {" +for file in "$@" +do + if test -f "$file" + then + unit=${file##*/} + unit=${unit%.in} + requires="`grep ^Requires= $file | cut -f 2- -d =`" + before="`grep ^Before= $file | cut -f 2- -d =`" + after="`grep ^After= $file | cut -f 2- -d =`" + echo "\"$unit\" [fillcolor=lightgray color=black fontcolor=black style=filled];" + for i in $requires + do + echo "\"$i\" -> \"$unit\" [color=red];" + done + for i in $after + do + echo "\"$i\" -> \"$unit\" [color=blue];" + done + for i in $before + do + echo "\"$unit\" -> \"$i\" [color=green];" + done + fi +done +echo "}" +) | dot -Tpng | display -